#pragma once

#include "BasicEvent.h"
#include "XString.h"

namespace events {

	
class SyncEvent : public BasicEvent
{
public:
	enum SyncEventType {
		SYNC_WAIT_SINGLE,
		SYNC_WAIT_SINGLE_EX,
		SYNC_WAIT_MULTIPLE,
		SYNC_WAIT_MULTIPLE_EX,
		SYNC_MSG_WAIT,
		SYNC_MSG_WAIT_EX
	};

public:
	inline SyncEvent(void)
		: BasicEvent(BasicEvent::EVENT_SYNC),
		  _setype(SYNC_WAIT_SINGLE),
		  _count((DWORD)0)
	{}

	inline SyncEvent(SyncEventType type, DWORD count)
		: BasicEvent(BasicEvent::EVENT_SYNC),
		  _setype(type),
		  _count(count)
	{}

	virtual ~SyncEvent(void) {}


public:
	SyncEventType getType(void) const { return _setype; }
	DWORD getCount(void) const { return _count(); }


	// implementing ISerializable
public:
	virtual void saveToStream(std::ostream &os) const;
	virtual void readFromStream(std::istream &is);
	virtual void writeDebugInfo(std::ostream &os) const;

private:
	SyncEventType _setype;
	GenericDataType<DWORD> _count;
};

}  // end namespace

